package com.zmm.weblog.admin.controller;

import com.zmm.weblog.admin.model.vo.tag.AddTagReqVo;
import com.zmm.weblog.admin.model.vo.tag.DeleteTagReqVo;
import com.zmm.weblog.admin.model.vo.tag.FindTagPageListReqVo;
import com.zmm.weblog.admin.model.vo.tag.SearchTagListReqVo;
import com.zmm.weblog.admin.service.AdminTagService;
import com.zmm.weblog.common.aspect.ApiOperationLog;
import com.zmm.weblog.common.utils.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:福禄寿
 * @Date:2024/4/30 下午4:36
 * @Des:weblog-springboot
 **/
@RestController
@RequestMapping("/admin/tag")
@Api(tags = "Admin 标签模块")
public class AdminTagController {

    @Autowired
    private AdminTagService adminTagService;

    @PostMapping("/add")
    @ApiOperation(value = "添加标签")
    @ApiOperationLog(description = "添加标签")
    public Response addTag(@RequestBody @Validated AddTagReqVo addTagReqVo){
        return adminTagService.addTag(addTagReqVo);
    }

    @PostMapping("/list")
    @ApiOperation(value = "标签分页数据获取")
    @ApiOperationLog(description = "标签分页数据获取")
    public Response findTagPageList(@RequestBody @Validated FindTagPageListReqVo pageListReqVo){
        return adminTagService.findTagPageList(pageListReqVo);
    }

    @PostMapping("/delete")
    @ApiOperation(value = "标签删除")
    @ApiOperationLog(description = "标签删除")
    public Response deleteCategory(@RequestBody @Validated DeleteTagReqVo tagReqVo){
        return adminTagService.deleteTag(tagReqVo);
    }

    @PostMapping("/select/list")
    @ApiOperation(value = "标签下拉列表框")
    @ApiOperationLog(description = "标签下拉列表框")
    public Response selectListTag(){
        return adminTagService.selectListTag();
    }

    @PostMapping("/search")
    @ApiOperation(value = "下拉框标签模糊查询")
    @ApiOperationLog(description = "下拉框标签模糊查询")
    public Response selectTag(@RequestBody @Validated SearchTagListReqVo searchTagReqVo){
        return adminTagService.selectTag(searchTagReqVo);
    }


}
